package com.testsoap;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

class EpisodeAdapter extends ArrayAdapter {
	 
    Activity context;
    Episode[] episodes;
 
    EpisodeAdapter(Activity context, Episode[] episodes) {
            super(context, R.layout.episodes_row, episodes);
            this.context = context;
            this.episodes = episodes;
        }
 
        public View getView(int position, View convertView, ViewGroup parent) {
        LayoutInflater inflater = context.getLayoutInflater();
        View item = inflater.inflate(R.layout.episodes_row, null);
 
        TextView lblTitulo = (TextView)item.findViewById(R.id.LblTitulo);
        lblTitulo.setText( episodes[position].getProperty(1).toString() + "X" + episodes[position].getProperty(2).toString() + " " + episodes[position].nombre);
 
        TextView lblSubtitulo = (TextView)item.findViewById(R.id.LblSubTitulo);
        lblSubtitulo.setText(episodes[position].serie);
 
        return(item);
    }
}
